<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="java.io.FileInputStream" %>
<%@ page import="java.io.ByteArrayOutputStream" %>
<%@ page import="java.io.IOException" %>
<%@ page import="java.io.InputStream" %>
<%@ page import="java.awt.image.BufferedImage" %>
<%@ page import="javax.imageio.ImageIO" %>
<%@ page import="java.io.File" %>
<%@ page import="java.util.Hashtable" %>
  
<%@ page import="com.google.zxing.BarcodeFormat" %>
<%@ page import="com.google.zxing.EncodeHintType" %>
<%@ page import="com.google.zxing.MultiFormatWriter" %>
<%@ page import="com.google.zxing.WriterException" %>
<%@ page import="com.google.zxing.common.BitMatrix" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<html lang="en">
<head>
<meta charset="utf-8" />
<head>
<base href="<%=basePath%>">

<title>ACLUserGroup</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="BWSoft">
<meta http-equiv="description" content="BWSoft">
<!-- basic styles -->
<link href="../../assetscss/bootstrap.min.css" rel="stylesheet" />
<link rel="stylesheet" href="../../assetscss/font-awesome.min.css" />

<link rel="stylesheet" href="../../assetscss/jquery-ui-1.10.3.custom.min.css" />
<link rel="stylesheet" href="../../assetscss/jquery.gritter.css" />

<!--[if IE 7]>
      <link rel="stylesheet" href="../../assetscss/font-awesome-ie7.min.css" />
    <![endif]-->
<!-- page specific plugin styles -->
<!-- fonts -->
<!-- ace styles -->

<link rel="stylesheet" href="../../assetscss/ace.min.css" />
<link rel="stylesheet" href="../../assetscss/ace-rtl.min.css" />
<link rel="stylesheet" href="../../assetscss/ace-skins.min.css" />
<link rel="stylesheet" href="../../assetscss/messenger.css" />
<link rel="stylesheet" href="../../assetscss/messenger-theme-future.css" />
 <link  rel="stylesheet"  href="../../assetscss/demo.css"/>
    <link  rel="stylesheet"  href="../../assetscss/zTreeStyle.css"/>

<!--[if lte IE 8]>
      <link rel="stylesheet" href="../../assetscss/ace-ie.min.css" />
    <![endif]-->
<!-- inline styles related to this page -->
<!-- ace settings handler -->

<script src="../../assetsjs/ace-extra.min.js"></script>

<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
    <script src="../../assetsjs/html5shiv.js"></script>
    <script src="../../assetsjs/respond.min.js"></script>
    <![endif]-->
<link href="../../assetscss/backOffice/backOffice.css" rel="stylesheet" />
<style type="text/css">
/* 选择图标样式的时候的样式 */
.onClick1 {
	border: solid 1px;
}

.onIcon {
	color: red;
}
</style>


</head>

<body>
	<%-- <a style="font-family: 微软雅黑;font-size: 20px;text-decoration: none;">客户端下载地址:</a><%=basePath%>../../assetsWeb/html/d/Download.html
 --%>

<%
	int BLACK = 0xFF000000;  
   
int WHITE = 0xFFFFFFFF;  
String text =basePath+"Web/html/d/Download.html"; 
String exts = "/../../assetsimages"; 
File f = new File(getServletContext().getRealPath("/")+exts);
        int width = 300;  
        int height = 300;  
        //二维码的图片格式  
        String format = "gif";  
        Hashtable hints = new Hashtable();  
        //内容所使用编码  
       		hints.put(EncodeHintType.CHARACTER_SET, "utf-8");
	BitMatrix bitMatrix = new MultiFormatWriter().encode(text, BarcodeFormat.QR_CODE, width, height, hints);
	//生成二维码  
	File outputFile = new File(f + "/core.gif");

	if (!f.exists()) {

		f.mkdir();

	}

	BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
	for (int x = 0; x < width; x++) {
		for (int y = 0; y < height; y++) {
			image.setRGB(x, y, bitMatrix.get(x, y) ? BLACK : WHITE);
		}
	}
	BufferedImage bimage = image;
	if (!ImageIO.write(image, format, outputFile)) {
		throw new IOException("Could not write an image of format " + format + " to " + outputFile);
	}
	out.println("<div style='text-align:center;'><img src='" + request.getContextPath() + exts + "/core.gif' /><br/>" + text + "<br/></div>");
%>
</body>
</html>
